import pytest
from page.app_page_login import PageLogin
from script import log
from tools import read_json


class TestAppLogin:
    arg_names = ["username", "password", "expect", "img"]

    @pytest.mark.parametrize(arg_names, read_json("login_data.json"))
    def test00_login(self, driver, username, password, expect, img):
        # 创建登录对象
        login = PageLogin(driver)
        login.page_login(username, password)
        result = login.get_toast_result()
        print(f"登录结果为：{result}")
        log.info(f"登录结果为：{result}")
        assert expect == result
        login.app_shot(img)
